Set setting_sources=[] to stop duplicating the prompt bundle#179
Merged
Conversation
Nerve builds the entire system prompt itself — the identity/memory bundle (SOUL/IDENTITY/USER/AGENTS/TOOLS/MEMORY) via system_prompt, plus permissions, MCP servers, hooks and env passed explicitly. Left at the default, the Claude Code CLI also auto-loads ~/.claude/CLAUDE.md (the bundle its own renderer writes for external claude-code use), duplicating tens of thousands of tokens on every turn. Passing setting_sources=[] disables all filesystem settings/memory loading. ["project"] alone is insufficient: the managed workspace lives under $HOME, so project-root detection climbs to $HOME and loads the user-level CLAUDE.md under both the "user" and "project" sources. Native skills/plugins are unaffected (loaded via plugins / --plugin-dir). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
pufit
approved these changes
Jul 17, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Nerve builds the entire system prompt itself: the identity/memory bundle (
SOUL/IDENTITY/USER/AGENTS/TOOLS/MEMORY) is injected viasystem_prompt, and permissions (can_use_tool), MCP servers (mcp_servers), hooks and env are all passed explicitly toClaudeAgentOptions.With
setting_sourcesleft at its default, the Claude Code CLI additionally loads filesystem settings/memory — including~/.claude/CLAUDE.md, which is the very same bundle the Claude Code renderer writes for external claude-code use. The result is the identity/memory bundle appearing twice in context — tens of thousands of duplicated tokens on every turn.Fix
Pass
setting_sources=[]in the Claude backend'sClaudeAgentOptions, disabling all filesystem-based settings/memory loading. Nerve owns the whole prompt, so there is nothing legitimate to load from disk.Why
[]and not["project"]An earlier attempt to drop only the user-level
CLAUDE.mdwith["project"]is insufficient: the managed workspace lives under$HOME, so the CLI's project-root detection climbs to$HOMEand loads~/.claude/CLAUDE.mdunder both the"user"and"project"sources. Only the empty list removes it entirely.Native skills/plugins are unaffected — they load via
plugins(--plugin-dir), independent ofsetting_sources.Verification
["project"]and["user"]both re-inject the bundle while[]does not (the emitted--setting-sources=is parsed as "none", not the default["user","project"]).1547 passed, 2 skipped.claudeMdcontext block, native skills still present.